// @ts-check
import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";

export default defineConfig({
  // //@ts-expect-error
  plugins: [react()],
  test: {
    setupFiles: "./tests/setup.mjs",
    environment: "jsdom",
    coverage: {
      thresholds: {
        branches: 20, // 自行设置合理值
        functions: 20,
        lines: 20,
      },
      include: ["src/"], // 只计算 src 内文件覆盖率
    },
  },

  resolve: {
    alias: [
      {
        find: "@",
        replacement: "/src", // 如果有设置 tsconfig.json paths 比如 `@`
      },
      {
        find: "name-in-package.json", // 组件名，package.json 的 name。目的是文档测试
        replacement: "/src",
      },
    ],
  },
});
